﻿@using tutors_clus.Models
@if (Request.IsAuthenticated) 
{
   
            tutors_clubContext db = new tutors_clubContext();
            string[] roles = Roles.GetRolesForUser();
            foreach (string role in roles)
            {
                
                if (role.Contains("Admin"))
                {
                     <ul data-role="listview" data-inset="true" data-theme="c">
                        <li>Xin chào,</li>
                        <li data-icon="gear">@Html.ActionLink("Admin", "Index", "Admin", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage"})</li>
                    </ul>
                    
                    @*<text>Xin chào, @Html.ActionLink("Admin", "Index", "Admin", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })</text>*@
                }
                else if (role.Contains("Teacher"))
                {
                    int id = WebSecurity.GetUserId(User.Identity.Name);
                    var name = db.teachers.Where(t=>t.id_tea == id).First();
                    <ul data-role="listview" data-inset="true" data-theme="c">
                        <li>Xin chào,</li>                       
                        <li>@Html.ActionLink(name.fullname_tea, "Index", "Teacher", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })</li>
                        
                        
                    </ul>
                    
                    @*<text>Xin chào, @Html.ActionLink(name.fullname_tea, "Index", "Teacher", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!</text>*@
                }
                else
	            {
                    int id = WebSecurity.GetUserId(User.Identity.Name);
                    var name = db.students.Where(t => t.id_stu == id).First();
                    <ul data-role="listview" data-inset="true" data-theme="c">
                        <li>Xin chào,</li>                       
                        <li>@Html.ActionLink(name.fullname_stu, "Index", "Student", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })</li>
                        <li>@Html.ActionLink("Đăng ký lớp mới","Course_No_Registered","Student")</li>
                    </ul>
                    @*<text>Xin chào, @Html.ActionLink(name.fullname_stu, "Index", "Student", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!</text>*@
	            }
            }
        
        using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) 
                            {
                                @Html.AntiForgeryToken()
                                <a data-theme="c" data-role="button" href="javascript:document.getElementById('logoutForm').submit()">Đăng xuất</a>
                            }
            
 }   
 else 
{

        @Html.ActionLink("Đăng ký", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink",data_role="button", data_theme="b" })
        @Html.ActionLink("Đăng nhập", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink",data_role="button", data_theme="b" })

}
